package com.zxy.health.controller;

import com.zxy.health.dao.ClassDao;
import com.zxy.health.dao.TeacherDao;
import com.zxy.health.service.ClassService;
import com.zxy.health.utils.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/class")
public class ClassController {

    @Autowired
    ClassService classService;

    @RequestMapping("/toClass")
    public String toTeacher(){
        return "class";
    }

    @RequestMapping("/insertClass")
    @ResponseBody
    public boolean insertClass(
            @Param("classname") String classname,
            @Param("classteacher" )String classteacher
    ){
        ClassDao classDao = new ClassDao(StringUtils.getSimpleUUID(),classname,classteacher);
        return classService.insertClass(classDao);
    }
}
